// home/success/success.js
const app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        style: app.globalData.style,
        mode: 'PAY'
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.setData({
            mode: options.mode
        })
        if (options.mode == 'PAY') {
            this.orderId = options.orderId;
            this.siteId = options.siteId;
            this.accommodate = options.accommodate;
        } else if (this.data.mode == 'PUBLISH') {
            this.activeId = options.activeId;
            this.activeName = decodeURIComponent(options.activeName);
            this.activeImage = decodeURIComponent(options.activeImage);
        } else if (this.data.mode == 'SIGN') {
            this.activeId = options.activeId;
        }
    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {
        if (this.data.mode == 'PUBLISH') {
            return {
                title: this.activeName,
                imageUrl: this.activeImage,
                path: `/active/active-details/active-details?id=${this.activeId}` + '&isShare=true'
            }
        }
    },

    onShareTimeline() {
        if (this.data.mode == 'PUBLISH') {
            return {
                title: this.activeName,
                imageUrl: this.activeImage,
                path: `/active/active-details/active-details?id=${this.activeId}` + '&isShare=true'
            }
        }
    },

    goPublish(e) {
        wx.navigateTo({
            url: '/myself/order/publish?orderId=' + this.orderId + '&siteId=' + this.siteId + '&accommodate=' + this.accommodate
        })
    },

    goOrderDetails(e) {
        wx.navigateTo({
            url: '/myself/order/order-details?id=' + this.orderId
        })
    },


    goActiveDetails(e) {
        wx.navigateTo({
            url: '/active/active-details/active-details?id=' + this.activeId
        })
    },

    goMyActiveDetails(e) {
      console.log(e);
      wx.navigateTo({
        url: '/myself/enroll/sign',
      })
        // wx.navigateTo({
        //     url: '/myself/enroll/my-active/details?id=' + this.activeId
        // })
    },

    goMyActive(e) {
        wx.navigateTo({
            url: '/myself/my-active/my-active'
        })
    },

    goHome(e) {
        wx.reLaunch({
            url: '/pages/active/active'
        })
    },

    goGroup() {
        wx.reLaunch({
            url: '/active/group/group'
        })
    }

})